<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/**
* @version		$Id: default.php
* @package		VirtueMart
* @subpackage modules
* @copyright	Copyright (C) 2012 Peter Osipof, 2009 Grigory Fedorinov, 2007 - 2008 Greg Perkins, 2007 -2008 YOOtheme Ltd. & Co. KG. All rights reserved.
* @license		GNU/GPL, http://www.gnu.org/copyleft/gpl.html
*
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
?>

<?php if($type == 'logout') : ?>
<form action="index.php" method="post" name="login">
<?php else : ?>
<form action="<?php echo JRoute::_( 'index.php', true, $params->get('usesecure')); ?>" method="post" name="login">
<?php endif; ?>

<span class="<?php echo $style ?>" style="display: block;">
	<span class="yoo-login">
	
		<?php if($type == 'logout') : ?>
		<span class="logout">

			<?php if ($params->get('greeting')) : ?>
			<span class="greeting">
			<?php if ($params->get('name')) : {
                		echo JText::sprintf( 'HINAME', $user->get('name') );
			} else : {
                		echo JText::sprintf( 'HINAME', $user->get('username') );
			} endif; ?>
			</span>
			<?php endif; ?>
			
			<span class="logout-button<?php echo "-" . $logout_button ?>">
				<button value="<?php if ( $logout_button == "text" ) { echo JText::_( 'BUTTON_LOGOUT'); } ?>" name="Submit" type="submit" title="<?php echo JText::_('BUTTON_LOGOUT'); ?>"><?php if ( $logout_button == "text" ) { echo JText::_( 'BUTTON_LOGOUT'); } ?></button>
			</span>
		
			<input type="hidden" name="option" value="com_user" />
			<input type="hidden" name="task" value="logout" />
			<input type="hidden" name="return" value="<?php echo $return; ?>" />
			
		</span>
		<?php if( $params->get('accountlink') || ENABLE_DOWNLOADS == '1' ) : ?>
                 <?php if( $params->get('accountlink')) : ?>
                  <span class="accountlink-button-container">
			<a class="accountlink-button<?php echo "-" . $accountlink_button ?>" href="<?php $sess->purl(SECUREURL . "index.php?page=account.index");?>" title="<?php echo $VM_LANG->_('PHPSHOP_ACCOUNT_TITLE'); ?>"><?php echo $VM_LANG->_('PHPSHOP_ACCOUNT_TITLE'); ?></a>
                  </span>
		<?php endif; ?>
		<?php if( $params->get('download') && ENABLE_DOWNLOADS == '1' ) : ?>
		<span class="download-button-container">
			<a class="download-button<?php echo "-" . $download_button ?>" href="<?php $sess->purl(SECUREURL . "index.php?page=shop.downloads");?>" title="<?php echo $VM_LANG->_('PHPSHOP_DOWNLOADS_TITLE'); ?>"><?php echo $VM_LANG->_('PHPSHOP_DOWNLOADS_TITLE');  ?></a>
		</span>
		<?php endif; ?>
                <?php
                // Show the Frontend ADMINISTRATION Link
                $perm = new ps_perm;
                if ($perm->check("admin,storeadmin")
                    && ((!stristr($my->get('usertype'), "admin") ^ PSHOP_ALLOW_FRONTENDADMIN_FOR_NOBACKENDERS == '' )
                        || stristr($my->get('usertype'), "admin")
                    )
                    && $show_adminlink == 'yes'
                ) { ?>
                <span class="admin-button-container">
			<a class="admin-button<?php echo "-" . $admin_button ?>" href="<?php $sess->purl(SECUREURL . "index2.php?page=store.index&pshop_mode=admin");?>" title="<?php echo $VM_LANG->_('PHPSHOP_ADMIN_MOD'); ?>"><?php echo $VM_LANG->_('PHPSHOP_ADMIN_MOD');  ?></a>
                 </span>
		<?php
		}
		?>

		<?php endif; ?>

		<?php else : ?>
		<span class="login">
		
			<?php echo $params->get('pretext'); ?>
			
			<span class="username">
			
				<?php if ($text_mode == "input") { ?>
				<input type="text" name="username" size="18" value="<?php echo JText::_( 'Username' ); ?>" onblur="if(this.value=='') this.value='<?php echo JText::_( 'Username' ); ?>';" onfocus="if(this.value=='<?php echo JText::_( 'Username' ); ?>') this.value='';" />
				<?php } else { ?>
				<label for="modlgn_username<?php echo $vmlogin_id; ?>"><?php echo JText::_( 'Username' ); ?></label>
				<br />
				<input id="modlgn_username<?php echo $vmlogin_id; ?>" type="text" name="username" size="18" />
				<?php } ?>
				
			</span>
			
			<span class="password">
			
				<?php if ($text_mode == "input") { ?>
				<input type="password" name="passwd" size="10" value="<?php echo JText::_( 'Password' ); ?>" onblur="if(this.value=='') this.value='<?php echo JText::_( 'Password' ); ?>';" onfocus="if(this.value=='<?php echo JText::_( 'Password' ); ?>') this.value='';" />
				<?php } else { ?>
				<label for="modlgn_passwd<?php echo $vmlogin_id; ?>"><?php echo JText::_( 'Password' ); ?></label>
				<br />
				<input id="modlgn_passwd<?php echo $vmlogin_id; ?>" type="password" name="passwd" size="10" />
				<?php } ?>
				
			</span>

			<?php if(JPluginHelper::isEnabled('system', 'remember')) : ?>
			<?php if ( $auto_remember ) { ?>
			<input type="hidden" name="remember" value="yes" />
			<?php } else { ?>
			<span class="remember">
				<input id="modlgn_remember<?php echo $vmlogin_id; ?>" type="checkbox" name="remember" value="yes" />
				<label for="modlgn_remember<?php echo $vmlogin_id; ?>"><?php echo JText::_( 'Remember me' ); ?></label>
			</span>
			<?php } ?>
			<?php endif; ?>
			
			<span class="login-button-container">
				<span class="login-button<?php echo "-" . $login_button ?>">
					<button value="<?php if ( $login_button == "text" ) { echo JText::_( 'BUTTON_LOGIN'); } ?>" name="Submit" type="submit" title="<?php echo JText::_('BUTTON_LOGIN'); ?>"><?php if ( $login_button == "text" ) { echo JText::_( 'BUTTON_LOGIN'); } ?></button>
				</span>
			</span>
			
			<?php if ( $lost_password ) { ?>
			<span class="lostpassword">
				<a href="<?php echo JRoute::_( 'index.php?option=com_user&view=reset' ); ?>"><?php echo JText::_('FORGOT_YOUR_PASSWORD'); ?></a>
			</span>
			<?php } ?>
			
			<?php if ( $lost_username ) { ?>
			<span class="lostusername">
				<a href="<?php echo JRoute::_( 'index.php?option=com_user&view=remind' ); ?>"><?php echo JText::_('FORGOT_YOUR_USERNAME'); ?></a>
			</span>
			<?php } ?>
			
			<?php
			$usersConfig = &JComponentHelper::getParams( 'com_users' );
			if ($usersConfig->get('allowUserRegistration') && $registration) { ?>
			<span class="registration">
				<a href="<?php echo $registration_url ?>"><?php echo JText::_( 'REGISTER'); ?></a>
			</span>
			<?php } ?>
			
			<?php echo $params->get('posttext'); ?>
			
			<input type="hidden" name="option" value="com_user" />
			<input type="hidden" name="task" value="login" />
			<input type="hidden" name="return" value="<?php echo $return; ?>" />
			<?php echo JHTML::_( 'form.token' ); ?>

		</span>
		
		<?php endif; ?>
		
	</span>
</span>
</form>
